package com.baidu.ota.presenter;

import com.baidu.commonlib.interfaces.IOtaAgent;
import com.baidu.ota.view.ICheckView;
import com.baidu.ota.view.IUpgradeView;

/**
 * presenter工厂类
 */
public final class PresenterFactory {

    private static IOtaAgent otaAgent;

    private PresenterFactory() {
    }

    public static ICheckPresenter get(IOtaAgent agent, ICheckView view, boolean system) {
        otaAgent = agent;
        return new CheckPresenterImpl(agent, view, system);
    }

    public static IUpgradePresenter get(IUpgradeView view) {
        if (otaAgent == null) {
            throw new RuntimeException("null object");
        }
        return new UpgradePresenterImpl(otaAgent, view);
    }
}
